/* 贪吃蛇游戏主页面样式 */

/* 全局样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
}

/* 英雄区域样式 */
.hero-section {
    background: linear-gradient(135deg, #28a745 0%, #20c997 50%, #17a2b8 100%);
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    display: flex;
    align-items: center;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255,255,255,0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255,255,255,0.1) 0%, transparent 50%),
        url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grid" width="10" height="10" patternUnits="userSpaceOnUse"><path d="M 10 0 L 0 0 0 10" fill="none" stroke="rgba(255,255,255,0.1)" stroke-width="0.5"/></pattern></defs><rect width="100" height="100" fill="url(%23grid)"/></svg>');
    opacity: 0.4;
}

.hero-section::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    animation: rotate 20s linear infinite;
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 自定义淡入动画 */
.fade-in-up {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.8s ease forwards;
}

.delay-1 {
    animation-delay: 0.3s;
}

.delay-2 {
    animation-delay: 0.6s;
}

@keyframes fadeInUp {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 页面加载时的动画效果 */
body.loaded .fade-in-up {
    animation-play-state: running;
}

.snake-preview {
    position: relative;
    animation: float 3s ease-in-out infinite;
    z-index: 0;
}

.snake-preview i {
    font-size: 8rem;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
    animation: snakeGlow 2s ease-in-out infinite alternate;
}

.snake-animation {
    width: 300px;
    height: 300px;
    border: 4px solid rgba(255, 255, 255, 0.4);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation: pulse 3s ease-in-out infinite;
    box-shadow: 
        0 0 60px rgba(255, 255, 255, 0.2),
        inset 0 0 60px rgba(255, 255, 255, 0.1);
}

.snake-animation::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 250px;
    height: 250px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: rotate 10s linear infinite;
}

.snake-animation::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: rotate 15s linear infinite reverse;
}

@keyframes snakeGlow {
    0% { 
        filter: drop-shadow(0 10px 20px rgba(255,193,7,0.5));
        transform: scale(1);
    }
    100% { 
        filter: drop-shadow(0 15px 30px rgba(255,193,7,0.8));
        transform: scale(1.05);
    }
}

/* 游戏模式卡片样式 */
.mode-card {
    transition: all 0.3s ease;
    border: 2px solid transparent !important;
}

.mode-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.175) !important;
    border-color: #28a745 !important;
}

.mode-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mode-card:hover .mode-icon {
    transform: scale(1.1);
}

/* 按键图标样式 */
.key-icon {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.1rem;
}

/* 动画效果 */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.5;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.1);
        opacity: 0.8;
    }
}

/* 响应式调整 */
@media (max-width: 768px) {
    .display-3 {
        font-size: 2.5rem;
    }
    
    .display-4 {
        font-size: 2rem;
    }
    
    .display-5 {
        font-size: 1.8rem;
    }
    
    .mode-icon {
        width: 60px;
        height: 60px;
    }
    
    .mode-icon .fs-2 {
        font-size: 1.5rem !important;
    }
}

/* 导航栏样式优化 */
.navbar-brand {
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.3s ease;
}

.navbar-nav .nav-link:hover {
    color: #ffc107 !important;
}

/* 按钮样式优化 */
.btn {
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    z-index: 10;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.5s;
}

.btn:hover::before {
    left: 100%;
}

.btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
}

.btn-warning {
    background: linear-gradient(45deg, #ffc107, #ffb300);
    border: none;
}

.btn-outline-light {
    border: 2px solid rgba(255,255,255,0.8);
    background: transparent;
    color: white;
}

.btn-outline-light:hover {
    background: rgba(255,255,255,0.1);
    border-color: white;
}

/* 卡片内容优化 */
.card-text {
    min-height: 60px;
}

/* 列表项样式 */
.list-unstyled li {
    margin-bottom: 0.5rem;
}

/* 页脚样式 */
footer {
    margin-top: 2rem;
}

/* 滚动平滑 */
html {
    scroll-behavior: smooth;
}

/* 加载优化 */
.mode-card {
    opacity: 0;
    animation: fadeInUp 0.6s ease forwards;
}

.mode-card:nth-child(1) { animation-delay: 0.1s; }
.mode-card:nth-child(2) { animation-delay: 0.2s; }
.mode-card:nth-child(3) { animation-delay: 0.3s; }
.mode-card:nth-child(4) { animation-delay: 0.4s; }

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #28a745;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #20c997;
}